package com.alicp.jetcache.redisson;

import com.alicp.jetcache.external.ExternalCacheBuilder;

/***
 * @author hxy
 */
public class RedissonCacheBuilder<T extends ExternalCacheBuilder<T>> extends ExternalCacheBuilder<T> {
    public static class RedissonCacheBuilderImpl extends RedissonCacheBuilder<RedissonCacheBuilderImpl> {
    }

    public static RedissonCacheBuilderImpl createRedisCacheBuilder() {
        return new RedissonCacheBuilderImpl();
    }

    protected RedissonCacheBuilder() {
        buildFunc(config -> new RedissonCache((RedissonCacheConfig) config));
    }

    @Override
    public RedissonCacheConfig getConfig() {
        if (config == null) {
            config = new RedissonCacheConfig();
        }
        return (RedissonCacheConfig) config;
    }

    public RedissonCacheBuilder setConfig(RedissonCacheConfig rconfig){
        config = rconfig;
        return this;
    }

}
